﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Microsoft Corp." file="GetOperationStatusCommand.cs">
//   All rights reserved. See License.txt in the project root for license information.
// </copyright>
// 
// --------------------------------------------------------------------------------------------------------------------
namespace AzureManagement.AzureCommands
{
    using System;

    using RestClient;

    public class GetOperationStatusCommand : AzureManagementCommand
    {
        private readonly string operationId;

        public GetOperationStatusCommand(IAzureServiceContext serviceContext, string operationId)
            : base(serviceContext)
        {
            if (string.IsNullOrEmpty(operationId))
            {
                throw new ArgumentException("Operation id must not be null or empty", "operationId");
            }

            this.operationId = operationId;
        }

        protected override RequestContext GetRequestContext()
        {
            return this.CreateGetOperationRequestContext();
        }

        protected override string FormatPath(IAzureServiceContext azureServiceContext)
        {
            return string.Format("{0}/operations/{1}", azureServiceContext.SubscriptionId, this.operationId);
        }
    }
}